change the NIC configuration accordingly after remove "nics=n"
authorXiaofeng Ling <xiaofeng.ling@intel.com>
Tue, 13 Dec 2005 10:57:04 +0000 (10:57 +0000)
committerXiaofeng Ling <xiaofeng.ling@intel.com>
Tue, 13 Dec 2005 10:57:04 +0000 (10:57 +0000)
otherwise, nics=-1 will be passed to device model and cause device
model exiting.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
tools/examples/xmexample.vmx
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index 8b694e32feabc5af77a3e082ce3eb736c5efaa23..6144be86d4363d255dcf2d9c77741eb4b0db0a82 100644 (file)
@@ -42,6 +42,8 @@ vcpus=1
 nics=1 
 # type=ioemu specify the NIC is an ioemu device not netfront
 vif = [ 'type=ioemu, bridge=xenbr0' ]
+# for multiple NICs in device model, 3 in this example
+#vif = [ 'type=ioemu, bridge=xenbr0', 'type=ioemu', 'type=ioemu']
 
 #----------------------------------------------------------------------------
 # Define the disk devices you want the domain to have access to, and
index b60c5f475459acc3ead23e6c84c81ff8dca04910..76d91709d781e1286948812b5b24184b494d81e7 100644 (file)
@@ -238,9 +238,7 @@ class VmxImageHandler(ImageHandler):
     # xm config file
     def parseDeviceModelArgs(self, imageConfig, deviceConfig):
         dmargs = [ 'cdrom', 'boot', 'fda', 'fdb', 'ne2000', 
-                   'localtime', 'serial', 'stdvga', 'isa', 'vcpus',
-                   'nics'
-                   ]
+                   'localtime', 'serial', 'stdvga', 'isa', 'vcpus']
         ret = []
         for a in dmargs:
             v = sxp.child_value(imageConfig, a)
@@ -262,6 +260,7 @@ class VmxImageHandler(ImageHandler):
         # Handle disk/network related options
         mac = None
         ret = ret + ["-domain-name", "%s" % self.vm.info['name']]
+        nics = 0
         for (name, info) in deviceConfig:
             if name == 'vbd':
                uname = sxp.child_value(info, 'uname')
@@ -283,6 +282,7 @@ class VmxImageHandler(ImageHandler):
                type = sxp.child_value(info, 'type')
                if type != 'ioemu':
                    continue
+               nics += 1
                if mac != None:
                    continue
                mac = sxp.child_value(info, 'mac')
@@ -299,6 +299,8 @@ class VmxImageHandler(ImageHandler):
                instance = sxp.child_value(info, 'pref_instance')
                ret.append("-instance")
                ret.append("%s" % instance)
+        ret.append("-nics")
+        ret.append("%d" % nics) 
         return ret
 
     def configVNC(self, config):
index 622bea9b18a5796efba83d2b895c7c7674065ceb..34d63170003d389dc7de371cb0d454147647e3aa 100644 (file)
@@ -545,8 +545,7 @@ def configure_vmx(config_image, vals):
     """
     args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
              'localtime', 'serial', 'stdvga', 'isa', 'nographic',
-             'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic',
-             'nics']
+             'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic']
     for a in args:
         if (vals.__dict__[a]):
             config_image.append([a, vals.__dict__[a]])